let app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
      console.log(options);
      var clock_id=options.clock_id;
      var open=wx.getStorageSync('open');
      var shared=options.share;
      if(shared==undefined){
        shared=0;
      }else{
        shared=1;
      }
      this.getClock(clock_id);
      this.setData({
        shared:shared,
        clock_id:clock_id,
        open:open,
        platform:app.globalData.platform,
       // city:app.globalData.city,
         width:app.globalData.windowWidth,
        height:app.globalData.windowHeight,
        statusBarHeight:app.globalData.statusBarHeight,
        navHeight:app.globalData.navHeight,
        marginTop:app.globalData.navTitleTop,
        domain:app.globalData.domain
      })
  },
  goIndex:function(){
    wx.reLaunch({
      url: '../default/index',
    })
  },
  getClock:function(clock_id){
    let that=this;
    var member=wx.getStorageSync('open');
    var member_id=member.member_id;
    wx.request({
      url:app.globalData.domain+'member/clock/getClockDay',
      data:{clock_id:clock_id,member_id:member_id},
      success:res=>{
       console.log(res);
       that.setData({
         clock:res.data.clock,
         clock_total:res.data.clock_total,
         clock_image:res.data.clock_image
       })
      }
    })

  },
  goBack:function(){
    wx.navigateBack();
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let url = encodeURIComponent('/pages/card/shareclock_id='+this.data.clock_id);
    var title='打卡详情';
    return {
      title: title,
      path: '/pages/card/shareclock_id='+this.data.clock_id+"&title="+title+"&share=5",
     }

  
  }, 
  onShareTimeline(){
    // console.log(e);
    var clock_id=this.data.clock_id;
    var title='打卡详情';
     this.setData({
       share:true
     });
     return{
       title: title,        
            
       query: 'clock_id='+clock_id+'&title='+title+"&share=5",        
       //imageUrl:'https://wl.browin.net.cn/static/wechat/ad1.png'      
       }
   },
   shareLine:function(e){
     
     this.setData({
   
       share:true
     })
   },
   hiddenShare:function(){
     this.setData({
       share:false
     })
   },

})